{include 
	file="file:$admin_theme_global_path/_header.tpl" 
	masthead="Edit" 
	tinymce=true 
	tinymce_field_id="post_body"
}
<form action="{url}/blog/admin/edit{/url}" method="post" enctype="multipart/form-data">
	{if isset($post.id)}
		<input type="hidden" name="id" value="{$post.id}"/>
	{/if}
	<div class="grid_12">
		<p>
			<label for="title" class="full">{t}Title{/t}</label>
			<input type="text" name="title" id="title" value="{$post.title}" />
		</p>
		{if isset($post)}
		<p>
			<label for="slug">{t}Post Slug{/t}</label>
			<span>{$post.slug}</span>
		</p>
		{/if}
		<p>			
			<textarea name="body" id="post_body">{$post.body}</textarea>
		</p>			
		<div class="clear"></div>
		<p>
			<label for="tags" class="full">{t}Tags{/t}</label>			
			<textarea name="tags">{$post.tags}</textarea>
		</p>
	</div>
	<div class="grid_4 sidenav">
		<h3>{t}Page Lifecycle{/t}</h3>
		{if $post.active}
			<p>{t}This post has been published.{/t}</p>
		{else}
			<p>{t}This page has not been published.{/t}</p>
		{/if}
		<p>{$workflow_state_id}</p>
		{if isset($post.id)}
			<p>
				<a target="preview" href="{url}/blog/index/preview/slug/{$post.slug}{/url}">{t}Preview{/t}</a>
			</p>
		{/if}
		<h3>{t}Publish{/t}</h3>
		{if count($workflow_options) gt 0}
			<ul>		
				<li>
					<label>{t}Action{/t}</label>
					{html_options name="workflow_status" id="workflow_status" selected=$workflow_state_id options=$workflow_options}
				</li>			
				{if isset($post.id)}
					<li><a href="{url}/blog/admin/delete/id/{$post.id}{/url}">{t}Delete Post{/t}</a></li>
				{/if}
			</ul>
		{else}
			<ul class="checkboxlist">
				<li>
					<label>
						<input type="checkbox" id="active" name="active" value="1"{if $post.active eq 1}checked="checked"{/if}/>
						{t}Active{/t}
					</label>
				</li>
			</ul>
		{/if}
		{if isset($post)}
			<p>
				<label class="full">{t}Last saved{/t}</label>{$post.updated_on|date_format:$format_datetime_small}
			</p>
		{/if}
		<p><label class="full">{t}Publish Date{/t}</label>
		{if $post.active eq 0 or !isset($post.id)}
			{html_select_date end_year="+10" time=$post.publish_on prefix="pubdate_"}
			{html_select_time time=$post.publish_on prefix="pubdate_"}
		{else}
			{$post.publish_on|date_format:$format_datetime_small}
		{/if}
		</p>
		<p>
			<input type="submit" value="{t}Save{/t}"/>
		</p>
	</div>
</form>
{include file="file:$admin_theme_global_path/_footer.tpl"}
